package cn.wolfcode.trip.base.service.impl;

import cn.wolfcode.trip.base.domain.NewsComment;
import cn.wolfcode.trip.base.domain.StrategyComment;
import cn.wolfcode.trip.base.mapper.NewsCommentMapper;
import cn.wolfcode.trip.base.query.QueryObject;
import cn.wolfcode.trip.base.service.INewsCommentService;
import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class NewsCommentServiceImpl implements INewsCommentService{
    @Autowired
    private NewsCommentMapper newsCommentMapper;
    public PageInfo list(QueryObject qo) {
        PageHelper.startPage(qo.getCurrentPage(), qo.getPageSize(), qo.getOrderBy());
        List<NewsComment> list = newsCommentMapper.selectForList(qo);
        return new PageInfo<NewsComment>(list);
    }

    public int queryForCount(Long newsId) {
        return newsCommentMapper.selectForCount(newsId);
    }

    @Override
    public void saveNewsComment(NewsComment newsComment) {
        newsCommentMapper.insert(newsComment);
    }
}
